<?php

class Session {
    private $lang_en;
    private $lang_sv;
    
    
    function __construct() {
        session_start();
        if (isset($_SESSION['lang'])):
            if ($_SESSION['lang'] == EN):
                $this->lang_en = true;
                $this->lang_sv = false;
            else:
                $this->lang_sv = true;
                $this->lang_en = false;
            endif;
        else:
            $this->lang_sv = false;
            $this->lang_en = true;
        endif;
        
        
    }

    public function setLang($variable) {
        if($variable == EN):
            $_SESSION['lang'] = EN;
            $this->lang_en = true;
            $this->lang_sv=false;
        endif;
            
        if($variable == SV):
            $_SESSION['lang'] = SV;
            $this->lang_en=false;
            $this->lang_sv=true;
        endif;
    }
    
    public function TVar($en,$sv){
        if($this->lang_en):
            return $en;
        endif;
        if ($this->lang_sv):
            return $sv;
        endif;
    }
    

   
}
$sess = new Session();

if(isset ($_GET['lang'])) {
    $sess->setLang($_GET['lang']);
}

?>